www.gusucode.com > VC 自绘窗口标题栏、边框、最大化、最小化、关闭按钮-源码 > VC 自绘窗口标题栏、边框、最大化、最小化、关闭按钮-源码程序/code/guidemo/MyToolTipCtrl.cpp

    //Download by http://www.NewXing.com
// MyToolTipCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "MyToolTipCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl

CMyToolTipCtrl::CMyToolTipCtrl()
{
}

CMyToolTipCtrl::~CMyToolTipCtrl()
{
}


BEGIN_MESSAGE_MAP(CMyToolTipCtrl, CToolTipCtrl)
	//{{AFX_MSG_MAP(CMyToolTipCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyToolTipCtrl message handlers

BOOL CMyToolTipCtrl::AddToolTip(UINT nID, CRect lpRect, LPCTSTR lpszText)
{

	TOOLINFO Tips;
	lpRect.top = lpRect.top +50;
	memset(&Tips, 0, sizeof(TOOLINFO));
	Tips.cbSize = sizeof(TOOLINFO);
	Tips.hwnd = GetOwner()->GetSafeHwnd();
	Tips.uFlags = TTF_SUBCLASS;
	Tips.uId = nID;
	memcpy(&Tips.rect, lpRect, sizeof(RECT));
	Tips.lpszText = (LPSTR)lpszText;
	return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM)&Tips);
}